<?php
namespace Home\Controller;
use Common\Util\WeiUtil;
use Think\Controller;
class UserController extends Controller {
	private $model;
	function _initialize(){
		$this->model=D('User');
	}
//	填写完整的信息
    public function index(){
		$code=I('code');
		if($code){
			$wei=new WeiUtil();
			$data=$wei->get_userinfo($code);
            $res=$this->model->is_add($data['openid']);
			if(!$res){
				$this->model->addData($data);
				$res=$this->model->is_add($data['openid']);
			}
			session('user',$res);
		}
		header("Location:".U('/Index/pay'));
    }
}